﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace BoxDiary
{
    public partial class Settings : UserControl
    {

        const string LPSAE = "单一用户账户加密(SAE)是一种保护您的隐私的二重加密手段。\n使用该" +
            "加密方法执行二重加密时，只有您本人的计算机账户才能解锁这些文件。其它的一切账户都无法" +
            "解锁这些文件。\n请注意：启用SAE有一定的风险，如果您一旦忘记您的计算机账户密码或者" +
            "丢失了您的计算机账户，我们将没有任何方法帮助您恢复这些文件。\n如果不是特别需要，" +
            "不建议您开启SAE。";


        public Settings()
        {
            InitializeComponent();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            if (Main.SAE)
            {
                checkBox1.Checked = true;
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                IniOperator.Write(
                    "Lab", "Single account encryption", "Open", Application.StartupPath + @"\Settings\settings.ini"
                    );
            }
            else
            {
                IniOperator.Write(
                    "Lab", "Single account encryption", "Close", Application.StartupPath + @"\Settings\settings.ini"
                    );
            }
        }

        private void linkLabel1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(LPSAE,"警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
        }
    }
}
